{% set navigation_bar = [
    ('/vipadmin/', 'index', '首页'),
    ('/vipadmin/manage/list/1', 'manage', '投放管理'),
    ('/vipadmin/throw/list/1', 'throw', '模板管理'),
    ('/vipadmin/types/list/1', 'types', '模板分类'),
] -%}
{% set active_page = active_page|default('index') -%}


<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{{ url_for('vipadmin.index') }}">广告投放系统</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

            <ul class="nav navbar-nav">
                {% for href, id, caption in navigation_bar %}
                    <li{% if id == active_page %} class="active"{% endif %}>
                        <a href="{{ href|e }}">{{ caption|e }}</a></li>
                {% endfor %}
            </ul>

            <ul class="nav navbar-nav navbar-right">
                {% if g.user %}
                    <li><a href="javascript:void(0)">当前账户，{{ g.user.username }}</a></li>
                {% endif %}
                <li><a href="{{ url_for('vipadmin.logout') }}">退出登录</a></li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
